//
//  ModelController.h
//  HWFinal
//
//  Created by student on 2021/12/2.
//  Copyright © 2021 demo. All rights reserved.
//

#ifndef ModelController_h
#define ModelController_h

#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
#import <AVFoundation/AVAssetImageGenerator.h>
#import <AVFoundation/AVTime.h>
#import <AFNetworking.h>

#import "User.h"
#import "RawUser.h"
#import "Article.h"
#import "Comment.h"
#import "Support.h"

@interface ModelController : NSObject

@property(strong, nonatomic) User* cur_user;

+(ModelController*)getInstance;

-(int) regist: (NSString*) u_id
  andPassword: (NSString*) password;
-(int) signIn: (NSString*) u_id
  andPassword: (NSString*) password;
-(int) signOut;
-(RawUser*) getRawUser: (NSString*) u_id;
-(User*) getUser: (NSString*) u_id;
-(int) modifyUser: (User*) user;

-(int) postArticle: (int) field
        andContent: (NSString*) content
         andImages: (NSMutableArray*) images;
-(NSMutableArray*) getArticleWithType: (int) type
                              andMode: (NSString*) mode;
-(NSMutableArray*) getCommentWithAID: (NSString*) a_id;
-(int) getSupportWithAID: (NSString*) a_id;
-(NSMutableArray*) queryArticle: (NSString*) str;
-(int) support: (NSString*) a_id;
-(int) comment: (NSString*) a_id
          with: (NSString*) content;
-(NSMutableArray*) getMyArticle;
-(NSMutableArray*) getMySupport;
-(NSMutableArray*) getMyComment;
-(Article*) getArticleWithAID: (NSString*) a_id;

-(BOOL) downloadFileToCache: (NSString*) url;
-(UIImage*) loadImageFromCache: (NSString*) url;
-(NSString*) loadVideoFromCache: (NSString*) url;
-(NSString*)moveMediaToCache:(NSString*)filePath;

-(UIImage*) getRawImg: (NSURL*) url;
@end

#endif /* ModelController_h */
